package com.niiwoo.civet.account.service.local.openAccount2.account;

import com.niiwoo.civet.account.dao.entity.AccountCompany;
import com.niiwoo.civet.account.dao.mapper.AccountCompanyMapperExt;
import com.niiwoo.civet.account.enums.AccountTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class AccountCompanyHandler implements AccountExtendOperation<AccountCompany> {

    @Autowired
    AccountCompanyMapperExt accountCompanyMapper;

    @Override
    public boolean save(AccountCompany accountCompany) {
        return accountCompanyMapper.insertSelective(accountCompany) > 0;
    }

    @Override
    public boolean update(AccountCompany accountCompany) {
        return accountCompanyMapper.updateByPrimaryKeySelective(accountCompany) > 0;
    }

    @Override
    public AccountCompany getByAccountId(long accountId) {
        return accountCompanyMapper.selectByPrimaryKey(accountId);
    }

    @Override
    public AccountTypeEnum getType() {
        return AccountTypeEnum.ENTERPRISE;
    }

}
